home *** CD-ROM | disk | FTP | other *** search
- /*
- *--- PCommand.cpp --------------------------------------------------------
- * Copyright (c) 1995-96 Adobe Systems Incorporated. All rights reserved.
- * Created on Thu, Oct 12, 1995 @ 9:54 PM by Paul Ferguson.
- *
- * Description: For notes about this class, refer to the
- * header file PCommand.h
- *-------------------------------------------------------------------------
- */
-
- #include <string.h>
-
- #include "PCommand.h"
- #include "PRequestBuf.h"
-
- PCommand::PCommand() // Note: This constructor does NOT call DoCommand().
- {
-
- }
-
- /*
- *--- PCommand constructor -------------------------------------
- * For commands with no parameters.
- *--------------------------------------------------------------
- */
- PCommand::PCommand(ePMCommand op)
- {
- DoCommand(op);
- }
-
-
- /*
- *--- PCommand constructor -------------------------------------
- * Issue a command that requires a single short integer
- * parameter (for example, the Alignment command).
- *--------------------------------------------------------------
- */
- PCommand::PCommand(ePMCommand op, short v)
- {
- itsPB->requestData = &v;
- itsPB->requestSize = sizeof(short);
- itsPB->requestStyle = kXRSPointer;
-
- DoCommand(op);
- }
-
- /*
- *--- PCommand constructor -------------------------------------
- * Issue a command that requires a single long integer parameter
- * (for example, the SelectID command).
- *--------------------------------------------------------------
- */
-
- PCommand::PCommand(ePMCommand op, long v)
- {
- itsPB->requestData = (void *) v;
- itsPB->requestSize = sizeof(long);
- itsPB->requestStyle = kXRSValue;
-
- DoCommand(op);
- }
-
- /*
- *--- PCommand constructor -------------------------------------
- * Issue a command that requires a C string parameter.
- *--------------------------------------------------------------
- */
-
- PCommand::PCommand(ePMCommand op, const char * theString)
- {
- itsPB->requestData = theString;
- itsPB->requestSize = strlen(theString) + 1;
- itsPB->requestStyle = kXRSPointer;
-
- DoCommand(op);
- }
-
- /*
- *--- PCommand constructor -------------------------------------
- * Issue a command with a formed request parameter buffer.
- *--------------------------------------------------------------
- */
-
- PCommand::PCommand(ePMCommand op, void * rawBuf, size_t theLen)
- {
- itsPB->requestData = rawBuf;
- itsPB->requestSize = theLen;
- itsPB->requestStyle = kXRSPointer;
-
- DoCommand(op);
- }
-
- /*
- *--- PCommand constructor -------------------------------------
- * Issue a command that has a request buffer with it.
- *--------------------------------------------------------------
- */
-
- PCommand::PCommand(ePMCommand op, PRequestBuf& request)
- {
- itsPB->requestData = (const char *) request;
- itsPB->requestSize = request.Size();
- itsPB->requestStyle = kXRSPointer;
- itsPB->requestUnits = 0;
-
- DoCommand(op);
- }
-
-
- /*
- *--- DoCommand ------------------------------------------------
- * All commands should clear the reply block before calling.
- *
- * Issue private callback using PCallback.
- *--------------------------------------------------------------
- */
-
- void PCommand::DoCommand(ePMCommand op)
- {
- itsPB->opCode = op;
-
- itsPB->replyData = NULL;
- itsPB->replySize = 0;
- itsPB->replyStyle = kXRSNull;
- itsPB->replyUnits = 0;
-
- CallPageMaker();
- }
-
- // end of PCommand.cpp
-